﻿<%@ Page Title="Events Page" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="Events.aspx.vb" Inherits="BeachesInGreeceComplete.Events" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </ajaxToolkit:ToolkitScriptManager>
    <h2>
        Events</h2>
    <div class="aside2">
        <br />
        <br />
        <h3>
            Search</h3>
        <br />
        <br />
        <asp:TextBox ID="tb_search" runat="server" />
        <br />
        <table>
            <tr>
                <td>
                    <asp:Button ID="btn_findByName" runat="server" Text="By Event" CssClass="m-btn blue" />
                </td>
                <td>
                    <asp:Button ID="btn_findByRegion" runat="server" Text="By Beach Name" CssClass="m-btn blue" />
                </td>
            </tr>
        </table>
        <br />
    </div>
    <div class="mainDiv4">
        <asp:Button ID="btn_Events" runat="server" Text="Create Event" CssClass="m-btn purple"
            PostBackUrl="~/AddEvent.aspx" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:ListView ID="ListView2" runat="server" DataKeyNames="ID" DataSourceID="SqlDataSource2">
                    <ItemTemplate>
                        <li id="liEvent">
                            <asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl='<%# Eval("ID", "ViewMembersInEvent.aspx?Event_FK={0}") %>'>
                                <asp:Label ID="lbl_Name" CssClass="BeachNameLabel" runat="server" Text='<%# Eval("EventName") %>' />
                            </asp:HyperLink>
                            <br />
                            <asp:Label ID="lbl_Region" CssClass="RegionLabel" runat="server" Text='<%# Eval("BeachName") %>' />
                            <br />
                            <asp:Label ID="lbl_When" CssClass="RegionLabel" runat="server" Text='<%# getEventTime(Eval("DateOfEvent")) %>'
                                ForeColor="#993399" />
                            <br />
                            <asp:Label ID="lbl_Capacity" CssClass="RegionLabel" runat="server" Text='<%# getAttendance(Eval("ToTalAttendees"), Eval("Capacity")) %>' />
                            <br />
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Beach_FK", "BeachDetails.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Thumbnail") %>'  alt="No picture found"  width="100" height="100" style="border-style: solid; border-width: medium" />
                            </asp:HyperLink>
                            <br />
                            <asp:Label ID="lbl_Time" runat="server" Text='<%# CalculateTime.calculateTimeNoHours(Eval("DateAdded")) %>'
                                ForeColor="#009999" />
                            <br />
                            By •
                            <asp:HyperLink ID="HyperLink2" runat="server" Text='<%# Eval("EventCreator")%>' NavigateUrl='<%# Eval("EventCreator", "Profile.aspx?Tourist={0}") %>'
                                ForeColor="Red" Font-Bold="True" CssClass="red" Font-Size="Smaller">
                                <asp:Label ID="TouristLabel" CssClass="BeachNameLabel" runat="server" Text='<%# Eval("EventCreator") %>' />
                            </asp:HyperLink><br />
                            <asp:Button ID="btn_Attend" runat="server" OnClick="Button_Click" Text="Attend" CommandArgument='<%# Eval("ID") %>'
                                CssClass="m-btn blue" />
                            <br />
                        </li>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <ul class="ItemContainer">
                            <li runat="server" id="itemPlaceholder" />
                        </ul>
                    </LayoutTemplate>
                </asp:ListView>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BeachConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:BeachConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [EventAttendance] ORDER BY ID DESC">
                </asp:SqlDataSource>
            </ContentTemplate>
        </asp:UpdatePanel>
        <br />
        <div class="nextLine">
            <asp:DataPager ID="DataPagerBeaches" runat="server" PagedControlID="ListView2" PageSize="13"
                Visible="False">
                <Fields>
                    <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                    <asp:NumericPagerField ButtonType="Link" />
                    <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False"
                        ButtonType="Link" ButtonCssClass="buttonDataPage" />
                </Fields>
            </asp:DataPager>
        </div>
        <br />
    </div>
    <br />
</asp:Content>
